﻿#ifndef _OI_PLSCANNERCORE_OPCTASK_HPP_
#define _OI_PLSCANNERCORE_OPCTASK_HPP_

#include "PLScannerCore/OiPLScannerCore.hpp"

namespace Oi
{
    namespace PLScannerCore
    {
        class ProductParams;

        class OI_PLSCANNER_CORE_API OPCTask : public QThread
        {
            Q_OBJECT

        public:
            OPCTask(QObject* parent = nullptr);

            ~OPCTask();

        public:
            void init();
            void exit();

        public:
            void run();
            void quit();
            void start();

        public:
            bool write(const WorkResult::Result& ouput);
            bool write(const QString name, const double value, int result);
            bool readSpecName(QString& name);
            bool readParams(ProductParams& params);
            bool readStatus(int& flag);
            bool heartbeat(int);
            bool readELWidth(double& value);

        public:
            static OPCTask* instance();

        private:
            OI_DISABLE_COPY(OPCTask);
            OI_DECLARE_IMPL(OPCTask);

        };

    }

}


#endif